package org.jgs1904.SimpleFactoryPattern;

import org.jgs1904.SimpleFactoryPattern.impl.BlackHuman;
import org.jgs1904.SimpleFactoryPattern.impl.WhiteHuman;
import org.jgs1904.SimpleFactoryPattern.impl.YellowHuman;

/**
 * @author 墨苍璃
 * @date 2023年07月10日15时44分
 * <p>
 * 造人工厂
 */
public class HumanFactor {

    /**
     * 静态 造人方法
     *
     * @param human
     * @return
     */
    public static Human creatHuman(Class human) {

        if (human == BlackHuman.class) {
            return new BlackHuman();
        }

        if (human == YellowHuman.class) {
            return new YellowHuman();
        }

        if (human == WhiteHuman.class) {
            return new WhiteHuman();
        }

        return null;

    }

}
